/*
 *  This file defines a spinlock type and a function to use it
 */

#ifndef _SPINLOCK_H
#define _SPINLOCK_H

//#define spinlock_t static volatile int
//typedef static volatile int spinlock_t;
typedef volatile int spinlock_t;

extern void spinlock_init(volatile int *lock_pointer);
extern int test_and_set(int new_value, volatile int *lock_pointer);

extern void lock_initialize(volatile int *p);
extern void lock_acquire(volatile int *p);
extern void lock_release(volatile int *p);
extern int lock_acquire_cli(volatile int *p);
extern void lock_release_sti(volatile int *p,int hwi);

#endif /* _SPINLOCK_H */
